import { IPSDEDBIndex } from './ipsdedbindex';
import { IPSDEDBIndexField } from './ipsdedbindex-field';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSDEDBIndexImpl extends PSModelObjectImpl implements IPSDEDBIndex {
  protected allpsdedbindexfields: IPSDEDBIndexField[] | null = null;

  getAllPSDEDBIndexFields(): IPSDEDBIndexField[] | null {
    if (this.allpsdedbindexfields == null) {
      this.allpsdedbindexfields = this.fillChildListModel(this.M.getAllPSDEDBIndexFields, 'database.IPSDEDBIndexField') as IPSDEDBIndexField[];
    }
    return this.allpsdedbindexfields;
  }

  get allPSDEDBIndexFields(): IPSDEDBIndexField[] | null {
    return this.getAllPSDEDBIndexFields();
  }

  findPSDEDBIndexField(objKey: any): IPSDEDBIndexField | null {
    return this.getPSModel5('database.IPSDEDBIndexField', this.getAllPSDEDBIndexFields(), objKey) as IPSDEDBIndexField;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get extendMode(): 0 | 2 {
    return this.M.extendMode != null ? this.M.extendMode : 0;
  }

  get indexType(): 'NORMAL' | 'UNIQUE' {
    return this.M.indexType;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get allowReverse(): boolean {
    return this.M.allowReverse != null ? this.M.allowReverse : false;
  }

  get cls(): string {
    return 'PSDEDBIndexImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'database.IPSDBIndexBase' || cls == 'database.IPSDEDBIndex') return true;
    return super.instanceof(cls);
  }
}
